#include "tree_traversal.h"
//#include "AVL.h"
#include <iostream>

void build_tree(Node * & root)
{
	Node *n = new Node[7];
	for (int i = 0; i<7; i++)
		n[i].key = i;
	n[0].parent = &n[1];
	n[1].left = &n[0]; n[1].right = &n[2]; n[1].parent = &n[3];
	n[2].parent = &n[1];
	n[3].left = &n[1]; n[3].right = &n[5];
	n[4].parent = &n[5];
	n[5].left = &n[4]; n[5].right = &n[6]; n[5].parent = &n[3];
	n[6].parent = &n[5];
	
	root = &n[3];
}

void test_traversal()
{
	Node *root;
	build_tree(root);
	std::cout << "inorder traversal\n";
	inorder_traverse_recursive(root); std::cout << std::endl;
	inorder_traverse_iterative(root); std::cout << std::endl;
	inorder_traverse_iterative2(root); std::cout << std::endl;
	inorder_traverse_with_stack(root);std::cout << std::endl;
	inorder_travers_with_stack_without_visit(root); std::cout << std::endl;
	//Node* root = Node::build_tree();
	//Node::print_tree(root);
	std::cout << "postorder traversal\n";
	postorder_traversal_recursive(root); std::cout << std::endl;
	postorder_traversal_stack(root); std::cout << std::endl;
	postorder_traversal_parent(root); std::cout << std::endl;
	postorder_reverse_preorder(root); std::cout << std::endl;

	std::cout << "preorder traversal\n";
	preorder_recursive(root); std::cout << std::endl;
	preorder_stack(root); std::cout << std::endl;
	preorder_parent(root); std::cout << std::endl;
}
void test_serialization();
void test_print_tree();
void test_min_max();
void test_kth_min_max();
void test_complete_full();
int main() {
	//test_print_tree();
	//test_kth_min_max();
	test_complete_full();
}